#include <QApplication>
#include "mainwindow.h"
#include "version.h"
#include <QTextCodec>//为了能够让程序标题显示中文
#include <QFontDatabase>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    QCoreApplication::setOrganizationName("COMPANY");
    QCoreApplication::setOrganizationDomain("PART");
    QCoreApplication::setApplicationName(QString("%1").arg(PROGRAM_TITLE));
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0)) //QT4因为不天然支持UTF-8才需要这样写
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#endif
#ifdef Q_OS_LINUX
    QFontDatabase::addApplicationFont("wqy-zenhei.ttc");
    a.setFont(QFont("WenQuanYi Zen Hei", 10, QFont::Normal));
#else
    QFontDatabase::addApplicationFont("msyh.ttf");
    a.setFont(QFont("MS Shell Dlg 2", 10, QFont::Black));//13
#endif

    w.setWindowTitle(QString("%1 ver %2")
                     .arg(PROGRAM_TITLE)
                     .arg(VER_NUMBER));
    w.show();
    return a.exec();
}
